package com.liyong.pullcenter;


import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.GetMapping;

import com.liyong.pullorder.channels.core.ChannelsPullService;
import com.liyong.pullorder.channels.dto.PullResponse;
import java.util.List;

@RestController
@RequestMapping("/api")
public class PullController {

    private final ChannelsPullService channelsPullService;

    public PullController(ChannelsPullService channelsPullService) {
        this.channelsPullService = channelsPullService;
    }

    // 拉单：platform 为 application.yml 中 platforms 的键，如 HUAWEI/ZJMOBILE
    @GetMapping("/orders/pull/{platform}")
    public PullResponse pull(@PathVariable("platform") String platformCode) {
        return channelsPullService.pull(platformCode);
    }

    // 查看已配置平台列表
    @GetMapping("/orders/platforms")
    public List<String> platforms() {
        return channelsPullService.supportedPlatforms();
    }
}